
layui.define(['upload', "table", "form", "laydate"], function(e) {
    var form = layui.form;
    var $ = layui.jquery;
    var upload = layui.upload;
    var ueditors = [];
    var laydate = layui.laydate;
    var obj = {
        enableEditor: function() {
            $('.ueditors').each(function() {
                var btn = $(this); //点击按钮对象
                var id = btn.attr("id");
                id = id.replace(/\#/, '');
                var w = "80%";
                var h = 150;
                ueditors[id] = UE.getEditor(id, {
                    initialFrameHeight: h,
                    initialFrameWidth: w,
                    autoFloatEnabled: false,
                    autoHeightEnabled: false,
                    allHtmlEnabled: false,
                    autoSyncData: true
                });
            });
        },
        enableFileUpload: function() {
            $('.ajax_file').each(function() {
                var btn = $(this); //点击按钮对象
                upload.render({
                    elem: btn[0],
                    accept: 'image',
                    multiple: true,
                    url: layui.setter.app_url + 'common/upload',
                    accept: 'image',
                    acceptMime: 'image/*',
                    size: 102400,
                    done: function(t) {
                        t.url = t.data.src[0];
                        1 == t.status ? $(this.elem).closest('.layui-form-item').find('.ajax_file_input').val(t.url) : e.msg(t.msg, {
                            icon: 5
                        })
                    }
                })
            })
        },
        enableDates: function() {
            $('.laydates').each(function() {
                var obj = $(this);
                laydate.render({
                    elem: obj[0],
                    format: 'yyyy-MM-dd'
                });
            });
        }
    };
    obj.enableEditor();
    obj.enableFileUpload();
    obj.enableDates();   
    e("common", obj);
    $(function() {
        //禁用鼠标右键
        $(document).bind("contextmenu", function(e) {
            return false;
        });
         
    })


    
});